<a href='http://github.com/angular/angular.js/edit/master/src/ngRoute/routeParams.js' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit">&nbsp;</i>Improve this doc</a>



<a href='http://github.com/angular/angular.js/tree/master/src/ngRoute/routeParams.js#L6' class='view-source pull-right btn btn-primary'>
  <i class="glyphicon glyphicon-zoom-in">&nbsp;</i>View Source
</a>


<header class="api-profile-header">
  <h1 class="api-profile-header-heading">$routeParams</h1>
  <ol class="api-profile-header-structure naked-list step-list">
    
  

    <li>
      - service in module <a href="api/ngRoute">ngRoute</a>
    </li>
  </ol>
</header>



<div class="api-profile-description">
  <p>The <code>$routeParams</code> service allows you to retrieve the current set of route parameters.</p>
<p>Requires the <a href="api/ngRoute"><code>ngRoute</code></a> module to be installed.</p>
<p>The route parameters are a combination of <a href="api/ng/service/$location"><code>$location</code></a>&#39;s
<a href="api/ng/service/$location#search"><code>search()</code></a> and <a href="api/ng/service/$location#path"><code>path()</code></a>.
The <code>path</code> parameters are extracted when the <a href="api/ngRoute/service/$route"><code>$route</code></a> path is matched.</p>
<p>In case of parameter name collision, <code>path</code> params take precedence over <code>search</code> params.</p>
<p>The service guarantees that the identity of the <code>$routeParams</code> object will remain unchanged
(but its properties will likely change) even when a route change occurs.</p>
<p>Note that the <code>$routeParams</code> are only updated <em>after</em> a route change completes successfully.
This means that you cannot rely on <code>$routeParams</code> being correct in route resolve functions.
Instead you can use <code>$route.current.params</code> to access the new route&#39;s parameters.</p>

</div>




<div>
  
  <h2 id="dependencies">Dependencies</h2>
  <ul>
    <li><a href="api/ngRoute/service/$route"><code>$route</code></a></li>
  </ul>
  

    

  

  
  
  



  
  <h2 id="example">Example</h2><pre><code class="lang-js"> // Given:
 // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby
 // Route: /Chapter/:chapterId/Section/:sectionId
 //
 // Then
 $routeParams ==&gt; {chapterId:&#39;1&#39;, sectionId:&#39;2&#39;, search:&#39;moby&#39;}</code></pre>

</div>


